home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / basic / ace_final.lha / ACE_GPL_Release / prgs / Misc / fact.b < prev    next >
Encoding:
Text File  |  1996-08-29  |  249 b   |  16 lines

  1. '...Recursive factorial.
  2.  
  3. Defsng f,n,x
  4.  
  5. Sub fact(n)
  6.   If n<2 Then fact=1 Else fact=n*fact(n-1)
  7. End Sub
  8.  
  9. Repeat
  10.   Print
  11.   Repeat
  12.     Input "Enter an integer (0 or higher, -1 to stop): ",x
  13.   Until x>=-1
  14.   If x<>-1 Then Print "-->>";fact(x)
  15. Until x=-1
  16.